/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gmao.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Amine
 */
@Entity
@Table(name = "atelier")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Atelier.findAll", query = "SELECT a FROM Atelier a"),
    @NamedQuery(name = "Atelier.findByNom", query = "SELECT a FROM Atelier a WHERE a.nom = :nom"),
    @NamedQuery(name = "Atelier.findByIdAtelier", query = "SELECT a FROM Atelier a WHERE a.idAtelier = :idAtelier")})
public class Atelier implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "nom")
    private String nom;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_atelier")
    private Integer idAtelier;
    @OneToMany(mappedBy = "idAtelier")
    private List<Employe> employeList;
    @OneToMany(mappedBy = "idAtelier")
    private List<Machine> machineList;

    public Atelier() {
    }

    public Atelier(Integer idAtelier) {
        this.idAtelier = idAtelier;
    }

    public Atelier(Integer idAtelier, String nom) {
        this.idAtelier = idAtelier;
        this.nom = nom;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public Integer getIdAtelier() {
        return idAtelier;
    }

    public void setIdAtelier(Integer idAtelier) {
        this.idAtelier = idAtelier;
    }

    @XmlTransient
    public List<Employe> getEmployeList() {
        return employeList;
    }

    public void setEmployeList(List<Employe> employeList) {
        this.employeList = employeList;
    }

    @XmlTransient
    public List<Machine> getMachineList() {
        return machineList;
    }

    public void setMachineList(List<Machine> machineList) {
        this.machineList = machineList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAtelier != null ? idAtelier.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Atelier)) {
            return false;
        }
        Atelier other = (Atelier) object;
        if ((this.idAtelier == null && other.idAtelier != null) || (this.idAtelier != null && !this.idAtelier.equals(other.idAtelier))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.gmao.entities.Atelier[ idAtelier=" + idAtelier + " ]";
    }
    
}
